Page({
  data:{
    list:[],
    current:1,
    pageSize:5,
    isShow:false
  },
  goPassport() {
    wx.navigateTo({
      url: '/visitor_pkg/pages/passport/index',
    })
  },
  async getPassList(){
    const {code,data:{rows:list,total}} = await wx.http.get('/visitor',{current:this.data.current,pageSize:this.data.pageSize})
    if(code!==10000) return wx.utils.toast()
    this.total=total
    console.log(list);
    if(this.data.current<total) this.setData({current:++this.data.current})
   if(list.length===0) return
    this.setData({
      list:[...this.data.list,...list],
      isShow:list.length===0
    })
  },
  //滑动到底部
  scrollDow(){
    this.getPassList()
  },
  onLoad(){
    this.getPassList()
  }
})
